import http from '../config/request';

/**
 * 用户登录
 * @param {string} account - 手机号或邮箱
 * @param {string} password - 密码
 * @returns {Promise} 返回登录请求的Promise对象
 */
export const login = ({ account, password }) => {
  return http.post('/login', {
    account,
    password
  });
};

/**
 * 用户注册
 * @param {string} employeeNo - 员工号
 * @param {string} password - 密码
 * @param {string} name - 姓名
 * @param {string} department - 部门
 * @returns {Promise} 返回 员工注册请求的Promise对象
 */
export const register = ({ name, gender, departmentId, position, phoneNumber, email, password, hireDate }) => {
  return http.post('/register/new', {
    name,
    gender,
    departmentId,
    position,
    phoneNumber,
    email,
    password,
    hireDate,
  });
};

/**
 * 人脸注册
 * @param {FormData} formData - 包含员工号和人脸图片的FormData对象
 * @returns {Promise} 返回 人脸注册请求的Promise对象
 */
export const faceRegister = (formData) => {
  return http.post('/register/face-enroll', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  });
};

